<template>
  <div class="layui-form">
    <div class="layui-form-item">
      <select name="city" lay-filter="changeSelect">
        <option value="" v-if="showDefault">{{placeholder}}</option>
        <option :value="option.value"
          v-for="(option, index) in options"
          :key="index"
        >{{option.label}}</option>
      </select>
    </div>
  </div>
</template>
<script>
export default {
  name: 'layuiSelect',
  mounted(){
    this.$form.render()
    this.$form.on("select(changeSelect)", ({value})=>{
      this.$emit('selectChange', value)
    })
  },
  props: {
    options: {
      type: Array,
      default: []
    },
    placeholder: {
      type: String,
      default: '请选择添加类型'
    },
    showDefault: {
      type: Boolean,
      default: true
    }
  }
}
</script>
